From 574b65be2fa808e62b0d2730dedde33a539eec12 Mon Sep 17 00:00:00 2001 From: "dan@guaranine.beaverton.ibm.com" Date: Wed, 16 Nov 2005 20:32:36 +0100 Subject: [PATCH] Make 01_reboot test more robust. We need to attach a console before rebooting to make sure the domain did actually boot in the first place. Also, use a better method for pulling out the uptime string. --- .../tests/reboot/01_reboot_basic_pos.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/xm-test/tests/reboot/01_reboot_basic_pos.py b/tools/xm-test/tests/reboot/01_reboot_basic_pos.py index 8037d44c13..e33c93a28f 100644 --- a/tools/xm-test/tests/reboot/01_reboot_basic_pos.py +++ b/tools/xm-test/tests/reboot/01_reboot_basic_pos.py @@ -18,6 +18,13 @@ except DomainError, e: print e.extra FAIL(str(e)) +try: + console = XmConsole(domain.getName()) +except ConsoleError, e: + FAIL(str(e)) + +console.closeConsole() + status, output = traceCommand("xm reboot %s" % domain.getName()) if status != 0: @@ -40,8 +47,11 @@ console.closeConsole() domain.destroy() -items = re.split(" +", run["output"]) -uptime = int(items[3]) -if uptime > 1: - FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot") +match = re.match("^[^up]*up ([0-9]+).*$", run["output"]) +if match: + if int(match.group(1)) > 1: + FAIL("Uptime too large (%i > 1 minutes); domain didn't reboot") +else: + FAIL("Invalid uptime string: %s (%s)" % (run["output"], match.group(1))) + -- 2.30.2